import Vue from 'vue'
import Vuex from 'vuex'
import persistedstate from 'vuex-persistedstate'
import routeModule from './route'
Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    /* 保存用户登录token */
    userObj:{},
    goodsObj:{},
  },
  getters: {
  },
  mutations: {
    getToken(state,obj) {
      state.userObj=obj;
    },
    addGoods(state,obj) {
      state.goodsObj = obj;
    }
  },
  actions: {
  },
  modules: {
    routeModule
  },
  plugins:[persistedstate({storage:window.sessionStorage})]
})
